package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 指派生产通知单操作类型枚举
 * @author 伍将
 * @date 2020/11/18
 * @version 2.0.0
 */
public enum EnhanceSupplierOperateTypeEnum {

    /**
     * 待提交审核生产通知单
     */
    TO_BE_VALIFY_COMMIT(1, "待提交审核生产通知单", "/memberCenter/handling/assign/tobeAddQuery"),
    /**
     * 待审核生产通知单（一级）
     */
    TO_BE_VALIFY_STEP1(2, "待审核生产通知单（一级）", "/memberCenter/handling/assign/pendingFirst"),
    /**
     * 待审核生产通知单（二级）
     */
    TO_BE_VALIFY_STEP2(3, "待审核生产通知单（二级）", "/memberCenter/handling/assign/pendingSecond"),
    /**
     * 待提交生产通知单
     */
    TO_BE_COMMIT(4, "待提交生产通知单", "/memberCenter/handling/assign/pendingSubmit"),
    /**
     * 待新增加工入库单
     */
    TO_BE_ADD_STORAGE(5, "待新增加工入库单", "/memberCenter/handling/assign/pendingAddProcessing"),
    /**
     * 待收货生产通知单
     */
    TO_BE_RECEIVE(6, "待收货生产通知单", "/memberCenter/handling/assign/pendingReceive");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    EnhanceSupplierOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static EnhanceSupplierOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(EnhanceSupplierOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
